package com.yanqu.road.server.timer.activity;

import com.yanqu.road.server.manger.activity.unionwar.UnionPhaseWarMgr;
import com.yanqu.road.server.manger.activity.unionwar.UnionWarActivityMgr;
import com.yanqu.road.utils.executor.GeneralTask;

public class CrossUnionWarOpenCheckTask extends GeneralTask {

    private long lastCheckTime;

    public static final int SYNC_TIME = 60 * 1000;      //每分钟同步一次

    @Override
    public void doRun() {
        try {
            //同步上传参与活动的商会
            UnionPhaseWarMgr.initCrossUnionWarUnion();
        }catch (Exception e){
            getLOGGER().error("initCrossUnionWarUnion error", e);
        }

        try {
            long nowTime = System.currentTimeMillis();
            if(nowTime - lastCheckTime > 600*1000){
                //检测/请求跨服战斗数据
                UnionPhaseWarMgr.requestBattleResult();
                //检测决赛锦囊返还
                UnionPhaseWarMgr.backUserGoodsInFinals();
                //请求跨服同步备战数据
//                UnionPhaseWarMgr.requestCrossSyncDetail();
                lastCheckTime = nowTime;
            }
        }catch (Exception e){
            getLOGGER().error("requestBattleResult backUserGoodsInFinals error", e);
        }

        //同步上传备战数据
        UnionPhaseWarMgr.syncUnionWarPrepareData();
    }
}